﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Royaumes_Libres.Database;

namespace Royaumes_Libres
{
    public partial class ucTopBarGame : System.Web.UI.UserControl
    {
        cKingdom Kingdom;
        cUsers User;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[Properties.Settings.Default.ObjUser] != null)
            {
                User = (cUsers)Session[Properties.Settings.Default.ObjUser];
                Kingdom = new cKingdom(User.PkUser, User.ActiveWorld);
                FillBar();
            }
        }

        protected void FillBar()
        {
            this.lblBarTimber.Text = cText.GetText("Timber").ToUpper();
            this.lblBarOre.Text = cText.GetText("Ore").ToUpper();
            this.lblBarFood.Text = cText.GetText("Food").ToUpper();
            this.lblBarMana.Text = cText.GetText("Mana").ToUpper();
            this.lblBarPop.Text = cText.GetText("Population").ToUpper();

            this.lblNbTimber.Text = Kingdom.Ressource.Timber.ToString();
            this.lblNbOre.Text = Kingdom.Ressource.Ore.ToString();
            this.lblNbFood.Text = Kingdom.Ressource.Food.ToString();
            this.lblNbMana.Text = Kingdom.Ressource.Mana.ToString();
            this.lblNbPop.Text = Kingdom.Ressource.Population.ToString();
        }
    }
}